import Request from '@/request'

export const getUser = <T extends object, R>(
  data: T
): Promise<IResponse<R>> => {
  return Request.get('/users/address', data)
}

export const addUser = <T extends object, R>(
  data: T
): Promise<IResponse<R>> => {
  return Request.post('/users/add', data)
}

export const updateUser = <T extends object, R>(
  data: T
): Promise<IResponse<R>> => {
  return Request.post('/users/update', data)
}

export const userLogin = <T extends object, R>(
  data: T
): Promise<IResponse<R>> => {
  return Request.post('/users/login', data)
}

export const userList = <T extends object, R>(
  data: T
): Promise<IResponse<IList<R>>> => {
  return Request.get('/users/list', data)
}

export const deleteUser = <T extends object, R>(
  data: T
): Promise<IResponse<R>> => {
  return Request.post('/users/delete', data)
}
